using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Impact.Model.Objects
{
	#region Tables Struct
	public partial struct Tables
	{
		
		public static string ArticleCategory = @"impact_ArticleCategories";
        
		public static string ArticleComment = @"impact_ArticleComments";
        
		public static string Article = @"impact_Articles";
        
		public static string ArticleTag = @"impact_ArticleTags";
        
		public static string EmailTemplate = @"impact_EmailTemplates";
        
		public static string EventX = @"impact_Events";
        
		public static string PagePlugin = @"impact_PagePlugins";
        
		public static string ImpactPage = @"impact_Pages";
        
		public static string PageType = @"impact_PageTypes";
        
		public static string PhotoGallery = @"impact_PhotoGalleries";
        
		public static string Photo = @"impact_Photos";
        
		public static string Profile = @"impact_Profiles";
        
		public static string RssSubscriber = @"impact_RssSubscribers";
        
		public static string Subscriber = @"impact_Subscribers";
        
		public static string Tag = @"impact_Tags";
        
		public static string Template = @"impact_Templates";
        
		public static string LoggingCategory = @"logging_Category";
        
		public static string LoggingCategoryLog = @"logging_CategoryLog";
        
		public static string LoggingLog = @"logging_Log";
        
	}
	#endregion
    #region Schemas
    public partial class Schemas {
		
		public static TableSchema.Table ArticleCategory{
            get { return DataService.GetSchema("impact_ArticleCategories","ImpactProvider"); }
		}
        
		public static TableSchema.Table ArticleComment{
            get { return DataService.GetSchema("impact_ArticleComments","ImpactProvider"); }
		}
        
		public static TableSchema.Table Article{
            get { return DataService.GetSchema("impact_Articles","ImpactProvider"); }
		}
        
		public static TableSchema.Table ArticleTag{
            get { return DataService.GetSchema("impact_ArticleTags","ImpactProvider"); }
		}
        
		public static TableSchema.Table EmailTemplate{
            get { return DataService.GetSchema("impact_EmailTemplates","ImpactProvider"); }
		}
        
		public static TableSchema.Table EventX{
            get { return DataService.GetSchema("impact_Events","ImpactProvider"); }
		}
        
		public static TableSchema.Table PagePlugin{
            get { return DataService.GetSchema("impact_PagePlugins","ImpactProvider"); }
		}
        
		public static TableSchema.Table ImpactPage{
            get { return DataService.GetSchema("impact_Pages","ImpactProvider"); }
		}
        
		public static TableSchema.Table PageType{
            get { return DataService.GetSchema("impact_PageTypes","ImpactProvider"); }
		}
        
		public static TableSchema.Table PhotoGallery{
            get { return DataService.GetSchema("impact_PhotoGalleries","ImpactProvider"); }
		}
        
		public static TableSchema.Table Photo{
            get { return DataService.GetSchema("impact_Photos","ImpactProvider"); }
		}
        
		public static TableSchema.Table Profile{
            get { return DataService.GetSchema("impact_Profiles","ImpactProvider"); }
		}
        
		public static TableSchema.Table RssSubscriber{
            get { return DataService.GetSchema("impact_RssSubscribers","ImpactProvider"); }
		}
        
		public static TableSchema.Table Subscriber{
            get { return DataService.GetSchema("impact_Subscribers","ImpactProvider"); }
		}
        
		public static TableSchema.Table Tag{
            get { return DataService.GetSchema("impact_Tags","ImpactProvider"); }
		}
        
		public static TableSchema.Table Template{
            get { return DataService.GetSchema("impact_Templates","ImpactProvider"); }
		}
        
		public static TableSchema.Table LoggingCategory{
            get { return DataService.GetSchema("logging_Category","ImpactProvider"); }
		}
        
		public static TableSchema.Table LoggingCategoryLog{
            get { return DataService.GetSchema("logging_CategoryLog","ImpactProvider"); }
		}
        
		public static TableSchema.Table LoggingLog{
            get { return DataService.GetSchema("logging_Log","ImpactProvider"); }
		}
        
	
    }
    #endregion
    #region View Struct
    public partial struct Views 
    {
		
		public static string ArticleTag = @"vw_impact_ArticleTags";
        
    }
    #endregion
    
    #region Query Factories
	public static partial class DB
	{
        public static DataProvider _provider = DataService.Providers["ImpactProvider"];
        static ISubSonicRepository _repository;
        public static ISubSonicRepository Repository {
            get {
                if (_repository == null)
                    return new SubSonicRepository(_provider);
                return _repository; 
            }
            set { _repository = value; }
        }
	
        public static Select SelectAllColumnsFrom<T>() where T : RecordBase<T>, new()
	    {
            return Repository.SelectAllColumnsFrom<T>();
            
	    }
	    public static Select Select()
	    {
            return Repository.Select();
	    }
	    
		public static Select Select(params string[] columns)
		{
            return Repository.Select(columns);
        }
	    
		public static Select Select(params Aggregate[] aggregates)
		{
            return Repository.Select(aggregates);
        }
   
	    public static Update Update<T>() where T : RecordBase<T>, new()
	    {
            return Repository.Update<T>();
	    }
     
	    
	    public static Insert Insert()
	    {
            return Repository.Insert();
	    }
	    
	    public static Delete Delete()
	    {
            
            return Repository.Delete();
	    }
	    
	    public static InlineQuery Query()
	    {
            
            return Repository.Query();
	    }
	    	    
	    
	}
    #endregion
    
}
#region Databases
public partial struct Databases 
{
	
	public static string ImpactProvider = @"ImpactProvider";
    
}
#endregion